<?php

class Store extends CI_Controller {
    
    public function __construct()
    {
        parent::__construct();
    }
    
    public function index()
    {
        $this->load->model('product_model');
        
        $res = $this->product_model->get_all_stored_item();
        
        if($res != false)
        {
            foreach($res as $row)
            {
                $dlist[] = $row;
            }
        }
        
        $data['main_content'] = 'store_view';
        $data['listview'] = $dlist;
        $this->load->view('include/template', $data);       
    }
    
    public function add_store()
    {
        $this->load->model('product_model');
        
        $res = $this->product_model->get_all_product_list();
        if($res != false)
        {
            foreach($res as $row)
            {
                $dlist[] = $row;
            }
        }

        $data['main_content'] = 'storeadd_view';
        $data['productlist'] = $dlist;
        $this->load->view('include/template', $data);       
    }
    
    public function store_new_db()
    {
        $this->load->model('product_model');
        
        $this->product_model->add_product_store();
        
        redirect('store/');
                
    }
}